import { IDispose } from "../../../../../com/gengine/core/IDispose";
import { ChatItemData } from "../chatViewData/ChatItemData";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ObjectPool } from "../../../../../com/gengine/utils/pools/ObjectPool";
import { ChatItem } from "./ChatItem";
import { Vector } from "../../../../../__AS3__/vec/Vector";
type int = number;
//class ChatNotes
    
    export  class ChatNotes /* flash.display.Sprite */ implements IDispose
    {
        constructor()
        {
            
            this._groupVector = new Vector.<flash.text.engine.ContentElement>();
            return;
        }

        public init(arg1: ChatItemData, arg2: int=260, arg3: number=21): void
        {
            this._width = arg2;
            this._lineHeight = arg3;
            this._itemData = arg1;
            this.mouseEnabled = false;
            this.createChildren();
            return;
        }

        /* internal  */createChildren(): void
        {
            this._itemTitleBg = GlobalClass.getBitmap("Chat_Channel_Bg");
            this._itemTitleBg.y = 0;
            this._itemTitleBg.x = 6;
            this.addChild(this._itemTitleBg);
            this._chatItem = ObjectPool.getObject(ChatItem);
            this._chatItem.init(this._itemData.getAllElements(), this._width, this._lineHeight);
            this.addChild(this._chatItem);
            var loc1=this._chatItem.getFirstLineHeight();
            if (loc1 < 30) 
            {
                this._itemTitleBg.y = (this._chatItem.getFirstLineHeight() - 16) / 2;
            }
            else 
            {
                this._itemTitleBg.y = 29;
            }
            return;
        }

        public /* override */ get height(): number
        {
            return this._chatItem.height;
        }

        public dispose(arg1: Boolean=true): void
        {
            this._itemData.dispose();
            this._itemData = null;
            this._width = 260;
            this._lineHeight = 21;
            this._groupVector = new Vector.<flash.text.engine.ContentElement>();
            this._chatItem.dispose();
            this._chatItem = null;
            var loc1=(this.numChildren - 1);
            while (loc1 >= 0) 
            {
                this.removeChildAt(loc1);
                --loc1;
            }
            x = 0;
            y = 0;
            ObjectPool.disposeObject(this);
            return;
        }

        /* internal */ /* var */_itemData: ChatItemData;

        /* internal */ /* var */_width: int;

        /* internal */ /* var */_lineHeight: number;

        /* internal */ /* var */_groupVector: Vector.<flash.text.engine.ContentElement>;

        /* internal */ /* var */_itemTitleBg: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_chatItem: ChatItem;
    }
